﻿<%@  Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Case.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% 
        var caz = ViewBag.Case as Case;
    %>
    <h2>
        Inregistrarea dosarului</h2>
    <div id="editform">
        <%
        Html.RenderAction("edit", new {id = caz.Id});%>
    </div>
    <br class="cbt"/>
    <br/>
    <div id="display">
        <%
        Html.RenderAction("summary", new {id = caz.Id});%>
    </div>
    <script type='text/javascript'>
        $(function () {
            regf();
        });

    function regf() {
        $('#editform form').ajaxForm({ success: function (d) {
            if (typeof d == "object") {
                $.get('<%=Url.Action("summary") %>', { id: '<%=caz.Id %>' }, function (d) { $('#display').html(d); });
                tell('titlul a fost salvat cu success');
                $.get('<%=Url.Action("edit", new{caz.Id}) %>', function (d) { $('#editform').html(d); regf(); });
            }
            else { $('#editform').html(d); regf(); }
        },
            url: '<%=Url.Action("edit", new{caz.Id}) %>'
        });
    }

    </script>
</asp:Content>
